# 字符串
val1 = "helloworld"
val2 = "Runoob"
print(val1)
print(val2)

# \转义
str = "D:\\Program Files\\Python 3.8\\python.exe"
print(str)

# r 去除转义
rstr = r'D:\Program Files\Python 3.8\python.exe'
print(rstr)

# 字符串格式化
name, year = 'python', 1989

print(name, '语言诞生于', year, '年')

print('{}语言诞生于{}年'.format(name, year))

# print("%s语言诞生于%d年",(name,year))
print("%s语言诞生于%d年" % (name, year))

print(f'{name}语言诞生于{year}年')

# 字符串运算符
strs = 'hello' + 'world'
print(strs)

strs1 = 'abc'
print(3 * strs1)
print(strs1 * 3)

strs2 = 'hello world.'
print(strs2[3])
print(strs2[4])
print(strs2[5])
print(strs2[6])
print(strs2[7])
print(strs2[11])
# print(strs2[12])

print('-----------------------')

# [start:stop:step]：切片 左闭右开原则
strs3 = "012356789"
print(strs3[::3])
print(strs3[::-3])
print(strs3[2:5:])

strs4 = 'abcdefg'

print('a' in strs4)
print('h' in strs4)

print('a' not in strs4)
print('h' not in strs4)

print('a\tb')
print(r'a\tb')

# input() 获取用户输入的字符串

# a=input("请输入你的名字：")
# b=input("请输入你的年龄：")
# c=input("请输入你最喜欢的城市名：")
# d=input("请输入你最喜欢的数字：")
# print(a,b,c,d)


# 强制类型转换
print(ord('a'))
# print(chr('b'))

test = float(input('输入一个浮点数：'))  # 在这里如的是一个整数
print('test变量现在的数据类型：', type(test))
